home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************
-
- G-Pen16専用部
- Copyright(C) 1991,1992,1993 Okome
- *****************************************************************/
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <EGB.h>
- #include <MOS.h>
- #include <Normlib.h>
- #include <GPen16.h>
- #include <GPenSub.c>
-
- void wsize( int mb, int s )
- {
- static int k=3;
- int h = 2;
- wget();
- wpg(0);
- boxf( (NX1-h)*bi-1, (NY1-h)*bi-1, (NX2+h+1)*bi, (NY2+h+1)*bi, BCL );
- wkugiri(0);
- nx[k] = NX1;
- ny[k] = NY1;
- if (mb & 1)
- k = (k+1) % (5+s);
- else
- {
- k = (k-1);
- if (k<0)
- k = 4+s;
- }
- wb = wallbl[k];
- NX4 = (8/bi) << k;
- NY4 = NX4;
- NX1 = nx[k];
- NY1 = ny[k];
- wpg(1);
- wput();
- wpg(0);
- if (NX4<WX4) wkugiri(1);
- biboxbf( NX1, NY1, NX2, NY2, 0, 4, 4 );
- wpg(1);
- }
-
- /* カラー選択パレット */
- void mcolms( int j ) /* カラーバー □表示 */
- {
- int c;
- c = ( mcl[0] / (1 << (j*5))) & 0x1f;
- j = 2 - j;
- boxf( PALX*bi + 1 , PALY*bi + j *PALB*bi + 1,
- PALX*bi + 255, PALY*bi +(j+1)*PALB*bi - 1, 0 );
- boxb( PALX*bi + c * 8 + 2, PALY*bi + j *PALB*bi + 2,
- PALX*bi + c * 8 + 7, PALY*bi +(j+1)*PALB*bi - 1, 8 );
- boxb( PALX*bi + c * 8 + 1, PALY*bi + j *PALB*bi + 1,
- PALX*bi + c * 8 + 6, PALY*bi +(j+1)*PALB*bi - 2, 15 );
- }
-
- void mcols( int k )
- {
- int j;
- if ( k != mcl[0] )
- {
- mcl[0] = k;
- boxf( PCX1, PCY1, PCX2, PCY2, mcl[0]);
- for ( k = 0; k <= 2; k++ )
- {
- EGB_writeMode( work, 3 );
- boxf(PALX , PALY+(k+1)*PALB-2,
- PALX+127, PALY+(k+1)*PALB-1, 0x1f * (1 << ((2 - k) * 5)));
- EGB_writeMode( work, 2 );
- boxf(PALX , PALY+(k+1)*PALB-2,
- PALX+127, PALY+(k+1)*PALB-1,
- mcl[0] & (0x7fff - 0x1f * (1 << ((2 - k) * 5))));
- }
- EGB_writeMode( work, 0 );
- wpg(0);
- for ( j=0; j<=2; j++)
- mcolms(j);
- wpg(1);
- }
- }
-
- void ptnsave16( char *name, int sx, int sy )
- {
- int x, y, p;
- FILE *fp;
- if ((fp = fopen( name, "wb")) == NULL )
- { return; }
- for (p=0; p<=3; p++ )
- {
- for ( y=0; y<BY4/sy; y++ )
- {
- for ( x=0; x<BX4/sx; x++ )
- {
- egbget(BX1+x*sx,BY1+y*sy,BX1+sx-1+x*sx,BY1+sy-1+y*sy,b);
- fwrite(b, 1, sx*sy*Cb/8, fp);
- }
- }
- }
- fclose(fp);
- }
-
- void ptnload16( char *name, int sx, int sy )
- {
- int x, y, p;
- FILE *fp;
- if ((fp = fopen( name, "rb")) == NULL )
- { return; }
- for (p=0; p<=3; p++ )
- {
- for ( y=0; y<BY4/sy; y++ )
- {
- for ( x=0; x<BY4/sx; x++ )
- {
- if (fread(b, 1, sx*sy*Cb/8, fp))
- egbput(BX1+x*sx,BY1+y*sy,BX1+sx-1+x*sx,BY1+sy-1+y*sy,b);
- }
- }
- }
- fclose(fp);
- }
-